<?php

/*
*
* BEGIN top_nav_content.php
*
*
* Dazzler Top Nav HTML Content
* @Description: The class creates all the UIs for the top nav of different page of dazzler
* @Authors: Salman, Wits University
* @Copyright: © Wits University 2011 - All Rights Reserved
* @License: BSD License (http://www.linfo.org/bsdlicense.html)
*
*
* BEGIN CHANGELOG
* Developers working on thee files are REQUIRED to maintain this CHANGELOG.
* Please ensure you follow the Changelog Guidelines: http://code.google.com/p/dazzler/wiki/DazzlerDevelopGuideline?ts=1315476570&updated=DazzlerDevelopGuideline
* !==================================================================================================================================================================
*
* VERSION 1.0.0
*	+ File Created, Salman, 20 September 2011
*
* ==================================================================================================================================================================!
* END CHANGELOG
*/


/*******************************************************************************************************************************************************************
*
* BEGIN Direct Call Check
*
/******************************************************************************************************************************************************************/
global $doNotCallThisScriptDirectly;
if ($doNotCallThisScriptDirectly != 1)
{
	/* Read the ini language file */
	$ini_lang_array = array();
	$clientlang = explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
	$lang_ini_array = (file_exists("lang/" . trim($clientlang[0]) . ".ini")) ? parse_ini_file("lang/" . trim($clientlang[0]) . ".ini", true) : parse_ini_file("lang/en.ini", true);
	die ($lang_ini_array['ERRORS']['doNotCallThisScriptDirectly']);
}
/*******************************************************************************************************************************************************************
*
* END Direct Call Check
*
/******************************************************************************************************************************************************************/

class top_nav_content extends baseClass
{

    private $htmlelementsbuilder;

    private $parsesiteconfig;

    public function  __construct()
    {
    $this->htmlelementsbuilder = new htmlelementsbuilder();
    $this->parsesiteconfig = new parsesiteconfig();
    }

     /**
     * \brief Builds html content for the top nav for the main home page
     * return Returns the html content for the top nav
     */
    private function buildMainTopNav()
    {
//        <a href="/">home</a>
        $pipe_seperation = new htmlcodemaker('text');
        $pipe_seperation->set('text', ' | ');

        $home_anchor = new htmlcodemaker('a');
        $home_anchor->set('href', '/dazzler');
        $home_anchor->set('title', 'home_link');
        $home_anchor->set('text', 'home');

        $commentators_anchor = new htmlcodemaker('a');
        $commentators_anchor->set('href', 'listofCommentators');
        $commentators_anchor->set('title', 'commentators_list_link');
        $commentators_anchor->set('text', 'commentators');

        $games_anchor = new htmlcodemaker('a');
        $games_anchor->set('href', 'listofGames');
        $games_anchor->set('title', 'games_list_link');
        $games_anchor->set('text', 'matches');

        $about_anchor = new htmlcodemaker('a');
        $about_anchor->set('href', 'about');
        $about_anchor->set('title', 'dazzler_about_link');
        $about_anchor->set('text', 'about');

        $contact_anchor = new htmlcodemaker('a');
        $contact_anchor->set('href', 'contact');
        $contact_anchor->set('title', 'contact_link');
        $contact_anchor->set('text', 'contact');

        $main_top_nav_links = new htmlcodemaker('span');
        $main_top_nav_links->inject(array($home_anchor, $pipe_seperation,$commentators_anchor,$pipe_seperation,$games_anchor,$pipe_seperation,$about_anchor,$pipe_seperation,$contact_anchor));
        return $main_top_nav_links->output();
    }

     /**
     * \brief This function builds html content for the top nav for the main page
     * \return This returns  html content for the top nav for the main page
     */
    public function showMainTopNav()
    {
        return $this->buildMainTopNav();
    }

}